?><?
class cls_file_lib_item extends cls_entity_item{
  var $id=0;
  var $name="";

  function entity(){return "file_lib";}

  function data_fields(){
    return array(
      "instance_id",
      "file_lib_id",
      "file_lib_name",
      "file_lib_title",
      "entity_name",
      "entity_id",
      "file_lib_size",
      "file_lib_temp",
      "file_lib_created",
      "file_lib_updated",
      "user_id",
    ); 
  }
  
  function insert($object,$data){
  	if($object){$data["entity_id"]=$object->id();}
  	if($object){$data["entity_name"]=$object->entity();}
  	return parent::insert(cls_file_lib_item::entity(),$data);
 	}
  function update($id,$data){return parent::update(cls_file_lib_item::entity(),$id,$data);}
  function delete($id){
    $file = cls_file_lib::item($id);
    if(unlink($file->name)){
  	  return parent::delete(cls_file_lib_item::entity(),$id,$data);
  	}else{
  	  return false;
  	}
  }

}